package com.jy.datapipeline.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @类名 StringUtil
 * @描述 TODO
 * @作者 白条君
 * @创建日期 2023/4/17 15:52
 * @版本 1.0
 */
public class StringUtil {

    public static String concat(StringBuffer stringBuffer, String... strings) {
        for (String string : strings) {
            stringBuffer.append(string);
        }
        return stringBuffer.toString();
    }

    public static boolean isNumber(String str) {
        for (int i = 0; i < str.length(); i++) {
            if (Character.isDigit(str.charAt(i))) {
                return true;
            }
        }
        return false;
    }

    public static boolean isNumberOrChinese(String str) {
        boolean flag = StringUtil.isNumber(str);
        if (!flag) {
            Pattern compile = Pattern.compile("[\\u4e00-\\u9fa5]");
            Matcher matcher = compile.matcher(str);
            while (matcher.find()) {
                flag = true;
            }
        }
        return flag;
    }
}
